﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Engine.Material.Shader;
using Engine.Light;
using Microsoft.Xna.Framework.Graphics;

namespace Etapa1.Screens
{
    public class ShadowShader : IShader
    {
        //Texture2D tex;

        //public void SetShadowTexture(Texture2D tex)
        //{
        //    this.tex = tex;
        //}

        public override void Initialize(Engine.EngineStuff es)
        {
            _shader = es.Content.Load<Effect>("..\\Content\\Effects\\deep2");
            base.Initialize(es);
        }
        public override void Attach(Engine.Cameras.ICamera cam)
        {
            _shader.Parameters["xWorldViewProjection"].SetValue(obj.getWorldMatrix() * cam.View * cam.Projection);
            _shader.Parameters["World"].SetValue(obj.getWorldMatrix());
            foreach (ILight item in lights)
            {
                if(item is SimpleLight)
                {
                    _shader.Parameters["xLightPos"].SetValue((item as SimpleLight).Position);
                 }
            }

            _shader.Parameters["xSolidBrown"].SetValue(false);
            _shader.Parameters["xLightPower"].SetValue(0.5f);
            _shader.Parameters["xAmbient"].SetValue(0.5f);
            //_shader.Parameters["xTexture"].SetValue(tex);
            
            base.Attach(cam);
        }
        
    }
}
